Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.Web
Imports System.Xml
Imports BlazeApps.Library.Reports

Partial Class Feeds_GalleryFeed
    Inherits WebPageBase

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim WC As New WebConfigSettings

        Response.Clear()
        Response.ContentType = "text/xml"
        Dim objX As New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
        objX.WriteStartDocument()
        objX.WriteStartElement("rss")
        objX.WriteAttributeString("version", "2.0")
        objX.WriteStartElement("channel")
        objX.WriteElementString("title", WC.GalleryFeedTitle)
        objX.WriteElementString("link", WebBase.AppPath)
        objX.WriteElementString("description", WC.GalleryFeedDesc)
        objX.WriteElementString("ttl", "5")

        Dim TopNItems As New ReportList

        For Each row As DataRow In TopNItems.GetTopNItemsByType(10, BlazeApps.Library.Base.ItemType.Resources).Tables(0).Rows
            objX.WriteStartElement("item")
            objX.WriteElementString("title", CType(row("title"), String))
            objX.WriteElementString("description", CType(row("summary"), String))
            objX.WriteElementString("link", "../default.aspx" & CType(row("urlparams"), String))
            objX.WriteElementString("pubDate", CType(row("createdate"), String))
            objX.WriteEndElement()
        Next

        objX.WriteEndElement()
        objX.WriteEndElement()
        objX.WriteEndDocument()
        objX.Flush()
        objX.Close()
        Response.End()
    End Sub

End Class
